import books.BookList;
import operation.SwitchOperation;


/*
import user.Admin;
import user.Code;
import user.NormalUser;
import user.User;

import java.util.Scanner;
*/

public class MainTest {
    public static void main(String[] args) {
        BookList bookList = new BookList();    // 定义书籍的存储顺序表

        SwitchOperation switchOperation = new SwitchOperation();      // 实例化 切换用户的类
        switchOperation.work(bookList);                               // 调用其中的，切换功能
    }
}




/**
 * 错误探究
 */

/*  User user = login();

        while(true) {
            if(null !=user) {
                int choice = user.menu();
                user.doOperation(choice,bookList);
            } else {
                break;
            }

        }


    }


    public static User login() {
        Scanner scanner = new Scanner(System.in);
        String name = null;
        int who = 0;

        System.out.println("请输入您的姓名:");
        name = scanner.nextLine();

        System.out.println("请输入您的身份登入:1.表示管理员、0.表示普通用户");
        who = scanner.nextInt();

        while(who !=1 && who !=0) {
            System.out.println("选择错误,请重新选择");
            who = scanner.nextInt();
        }

        if(1 == who) {
            if(Code.passWord()) {
                return new Admin(name);
            }else{
                return null;
            }
        }

        if(0 == who) {
            return new NormalUser(name);  // 注意返回类型，父类，向上转型
        }


      *//*  switch(who) {
            case 0:
                return new NormalUser(name);  // 注意返回类型，父类，向上转型
            case 1:
                if(Code.passWord()) {
                    return new Admin(name);
                }else{
                    return null;
                }
            default:
                System.out.println("选择错误,请重新选择");
                login();
                break;
        }*//*


        return null;  // 这一步是不会执行的

        */


